#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;


void solve1() {
	int k;
	cin >> k;
	double ans = 0;
	int n;

	for (int i = 1; ans <= k; ++i) {
		ans = ans + 1 / double(i);
		n = i;
	}
	cout << n;

	return;
}

int solve2() {

	int k;
	cin >> k;
	int ans = k;
	int m_Count = 0;
	for (int i = 1; ; ++i) {
		for (int j = i; j >= 1; --j) {
			m_Count += i;
			ans--;
			if (ans <= 0)
				return m_Count;
		}
	}
	return 0;
}

void solve3() {

	int  n;
	cin >> n;
	int  ans = 0;
	for (int i = 1; i <= n; ++i) {
		ans += i;
	}
	cout << ans;
	return;
}

//埃氏素数筛
void solve4() {
	int L;
	int ret = 0;
	cin >> L;


	vector<bool> isPrime(L + 1, true);
	for (int p = 2; p * p <= L; p++) {
		if (isPrime[p]) {
			for (int i = p * p; i <= L; i += p) {
				isPrime[i] = false;
			}
		}
	}
	int ans = 0;
	for (int i = 2; i <= L; i++) {
		if (isPrime[i]) {
			if (ret + i <= L) {
				ans++;
				ret += i;
				cout << i << '\n';
			}
		}

	}
	cout << ans;
	return;
}

void solve5() {
	string s;
	cin >> s;
	if (s == "0") {
		cout << 0;
		return;
	}
	if (s[0] == '-') {
		cout << '-';
	}
	while (s[s.size() - 1] == '0') {
		s.pop_back();
	}
	for (int i = s.size() - 1; i >= 0; --i) {
		if (s[i] == '-')
			continue;
		cout << s[i];
	}

	return;
}

void solve6() {
	double x;
	cin >> x;
	double ans = 0;
	double juli = 2;
	int i;
	for (i = 1; ; ++i) {
		ans = ans + juli;
		if (ans >= x)
			break;
		juli *= 0.98;
	}
	cout << i;

	return;
}


bool check(int x) {
	string s = to_string(x);
	for (int i = 0; i <= s.size() / 2; ++i) {
		if (s[i] != s[s.size() - 1 - i]) 
			return false;		
	}
	return true;
}

void solve7() {
	int L;
	int R;
	int ret = 0;
	cin >> L >> R;


	vector<bool> isPrime(R + 1, true);
	for (int p = 2; p * p <= R; p++) {
		if (isPrime[p]) {
			for (int i = p * p; i <= R; i += p) {
				isPrime[i] = false;
			}
		}
	}
	for (int i = L; i <= R; i++) {
		if (isPrime[i] && check(i)) 			
				cout << i << '\n';
			
	}
	return;

}

void slove8() {
	int n, x;
	cin >> n;
	int mini = 1001;
	int maxi = -1;
	for (int i = 0; i < n; ++i) {
		cin >> x;
		mini = min(mini, x);
		maxi = max(maxi, x);
	}
	cout << maxi - mini;
	return;
}

void slove9() {
	int n;
	cin >> n;
	double q_5 = sqrt(5);
	double a = pow((1 + q_5) / 2, n);
	double b = pow((1 - q_5) / 2, n);
	double result = (a - b) / q_5;
	printf("%.2f", result);
	return;
}

const int N = 1e4 + 10;
int a[N];
int ans = 1;
void slove10() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	int temp = 1;
	for (int i = 1; i < n; ++i) {
		if (a[i + 1] - a[i] != 1) {
			temp = 1;
			continue;
		}			
		else
			temp++;
		ans = max(ans, temp);
	}
	cout << ans;
	return;
}

const int M = 1e3 + 10;
int b[M];

void slove11() {
	int n;
	cin >> n;
	double res1 = 0;
	for (int i = 1; i <= n; ++i) {
		cin >> b[i];
	}
	sort(b + 1, b + 1 + n);
	for (int i = 2; i < n; ++i) {
		res1 += b[i];
	}
	printf("%.2f", res1 / double((n - 2)));

	return;
}

int main() {
	//solve1();
	//cout<<solve2();
	//solve3();
	//solve4();
	//solve5();
	//solve6();
	//solve7();
	//slove8();
	//slove9();
	//slove10();
	slove11();
	return 0;
}